/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.myapp.forms;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author navneet
 */
public class AEDAFB extends org.apache.struts.validator.ValidatorActionForm {
    private int groupId;
    private int companyId;
    private int siteId;
    private int entityId;
    private String field_name;
    private String field_type;
    private String field_length;
    private String field_default_type;
    private String field_default_value;
    private String field_collation;
    private String field_null;
    private String field_key;
    private String field_auto;
    private String description;
    private String error;

    public int getEntityId() {
        return entityId;
    }

    public void setEntityId(int entityId) {
        this.entityId = entityId;
    }
    
    public int getCompanyId() {
        return companyId;
    }

    public void setCompanyId(int companyId) {
        this.companyId = companyId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public String getField_auto() {
        return field_auto;
    }

    public void setField_auto(String field_auto) {
        this.field_auto = field_auto;
    }

    public String getField_collation() {
        return field_collation;
    }

    public void setField_collation(String field_collation) {
        this.field_collation = field_collation;
    }

    public String getField_default_type() {
        return field_default_type;
    }

    public void setField_default_type(String field_default_type) {
        this.field_default_type = field_default_type;
    }

    public String getField_default_value() {
        return field_default_value;
    }

    public void setField_default_value(String field_default_value) {
        this.field_default_value = field_default_value;
    }

    public String getField_key() {
        return field_key;
    }

    public void setField_key(String field_key) {
        this.field_key = field_key;
    }

    public String getField_length() {
        return field_length;
    }

    public void setField_length(String field_length) {
        this.field_length = field_length;
    }

    public String getField_name() {
        return field_name;
    }

    public void setField_name(String field_name) {
        this.field_name = field_name;
    }

    public String getField_null() {
        return field_null;
    }

    public void setField_null(String field_null) {
        this.field_null = field_null;
    }

    public String getField_type() {
        return field_type;
    }

    public void setField_type(String field_type) {
        this.field_type = field_type;
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }

    public int getSiteId() {
        return siteId;
    }

    public void setSiteId(int siteId) {
        this.siteId = siteId;
    }

    public AEDAFB() {
        super();
    }

    @Override
    public void reset(ActionMapping mapping, HttpServletRequest request) {
        groupId                 = -1;
        companyId               = -1;
        siteId                  = -1;
        entityId                = -1;
        field_name              = "";
        field_type              = "";
        field_length            = "";
        field_default_type      = "";
        field_default_value     = "";
        field_collation         = "";
        field_null              = "";
        field_key               = "";
        field_auto              = "";
        description             = "";
        error                   = "";
    }

    @Override
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (getGroupId() < 1) {
            errors.add("groupId", new ActionMessage("error.AFAFB.groupId.required"));
        }
        if (getCompanyId() < 1) {
            errors.add("companyId", new ActionMessage("error.AFAFB.companyId.required"));
        }
        if (getSiteId() < 1) {
            errors.add("siteId", new ActionMessage("error.AFAFB.SiteId.required"));
        }
        if (getEntityId() < 1) {
            errors.add("entityId", new ActionMessage("error.AFAFB.entityId.required"));
        }
        if (getField_name() == null || getField_name().length() < 1) {
            errors.add("field_name", new ActionMessage("error.AFAFB.field_name.required"));
        }
        if (getField_type() == null || getField_type().length() < 1) {
            errors.add("field_type", new ActionMessage("error.AFAFB.field_type.required"));
        }
        if (getField_length() == null || getField_length().length() < 1) {
            errors.add("field_length", new ActionMessage("error.AFAFB.field_length.required"));
        }
        return errors;
    }
}
